/*!
 * \file frproto_cfg_load.c
 *
 * All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.\n
 *
 * \version 3.0
 * \author geyh
 * \date 2016/03/31
 *
 */
#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"
#include "frlist.h"
#include "frproto_mng.h"
#include "apmtest_cunit.h"

#include "apmtest_comm.h"

extern int g_i_flag_run;

static int __suite_init(void)
{
//    frmodule_mng_init();
    return 0;
}

static int __suite_cleanup(void)
{
//    frmodule_mng_destory();
    return 0;
}

static void __case1(void)
{
    int i_ret = 0;
    int i_reload = FR_YES;

    g_i_flag_run = 0;
    frproto_mng_init();
    i_ret = frproto_cfg_load(i_reload);

    g_i_flag_run = 1;
    frproto_mng_destory();

    CU_ASSERT_EQUAL(i_ret, FR_SUCC);
    return;

}

static void __case2(void)
{
    int i_ret = 0;
    int i_reload = FR_NO;

    g_i_flag_run = 0;
    frproto_mng_init();
    i_ret = frproto_cfg_load(i_reload);

    g_i_flag_run = 1;
    frproto_mng_destory();

    CU_ASSERT_EQUAL(i_ret, FR_SUCC);
    return;

}



int add_suite_frproto_cfg_load(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite("frproto_mng frproto_cfg_load()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    CU_add_test(pSuite, "case1", __case1);
    CU_add_test(pSuite, "case2", __case2);
//    CU_add_test(pSuite, "case3", __case3);
//    CU_add_test(pSuite, "case4", __case4);
//    CU_add_test(pSuite, "case5", __case5);

    return FR_SUCC;
}
